package org.thread.test05.demo06.demo03;

/**
 * @author ZJL
 * @date 2025-03-13
 */
public class MyThread extends Thread {
    /**
     * 定义锁对象 - 公开
     */
    public static final String LOCK = "";
    @Override
    public void run() {
        synchronized (LOCK) {
            try {
                // 线程等待 - wait方法释放锁对象
                //LOCK.wait();
                // 线程睡眠 - sleep方法不会释放锁对象
                Thread.sleep(5000);
                System.out.println("唤醒子线程，执行相关的业务代码...");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
